<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">
		<h1>Novo Projeto</h1>
		<h:form id="projeto" styleClass="edit">

			<rich:panel>
				<f:facet name="header">Termo de Abertura de Projeto</f:facet>

				<h:panelGrid columns="2" columnClasses="">

					<s:decorate id="nomeField" template="layout/edit.xhtml">
						<ui:define name="label">Nome do Projeto</ui:define>
						<h:inputText id="nome" size="15"
							value="#{projetoHome.instance.nome}" />
					</s:decorate>

					
					<s:decorate id="nomeField" template="layout/edit.xhtml">
						<ui:define name="label">Gerente de Projeto</ui:define>
						<h:inputText id="nome" size="15"
							value="#{projetoHome.instance.nome}" />
					</s:decorate>

					<s:decorate id="clienteField" template="layout/edit.xhtml">
						<ui:define name="label">Cliente</ui:define>
						<h:inputText id="cliente" size="15"
							value="#{projetoHome.instance.cliente}" />
					</s:decorate>

					<s:decorate id="orcamentoField" template="layout/edit.xhtml">
						<ui:define name="label">Orcamento Previsto</ui:define>
						<h:inputText id="orcamento"
							value="#{projetoHome.instance.orcamento}">
							<a:support event="onblur" reRender="orcamentoField"
								bypassUpdates="true" ajaxSingle="true" />
						</h:inputText>
					</s:decorate>

					<s:decorate id="inicioField" template="layout/edit.xhtml">
						<ui:define name="label">Inicio Previsto</ui:define>
						<rich:calendar id="inicio" required="true"
							value="#{projetoHome.instance.inicio}"
							datePattern="MM/dd/yyyy hh:mm a" />
					</s:decorate>

					<s:decorate id="fimprevistoField" template="layout/edit.xhtml">
						<ui:define name="label">Fim Previsto</ui:define>
						<rich:calendar id="fimprevisto"
							value="#{projetoHome.instance.fimprevisto}"
							datePattern="MM/dd/yyyy hh:mm a" />
					</s:decorate>

				</h:panelGrid>

				<s:decorate id="resumoField" template="layout/edit.xhtml">
					<ui:define name="label">Resumo das condições do projeto</ui:define>
					<h:inputTextarea id="resumo" cols="90" rows="5"
						value="#{projetoHome.instance.resumo}" />
				</s:decorate>

				<s:decorate id="justificativaField" template="layout/edit.xhtml">
					<ui:define name="label">Justificativa do projeto</ui:define>
					<h:inputTextarea id="justificativa" cols="90" rows="5"
						value="#{projetoHome.instance.justificativa}" />
				</s:decorate>

				<s:decorate id="necessidadesField" template="layout/edit.xhtml">
					<ui:define name="label">Necessidades básicas do trabalho a ser realizado</ui:define>
					<h:inputTextarea id="necessidades" cols="90" rows="5"
						value="#{projetoHome.instance.necessidades}" />
				</s:decorate>

				<s:decorate id="premissasField" template="layout/edit.xhtml">
					<ui:define name="label">Premissas iniciais</ui:define>
					<h:inputTextarea id="premissas" cols="80" rows="3"
						value="#{projetoHome.instance.premissas}" />
				</s:decorate>

				<s:decorate id="restricoesField" template="layout/edit.xhtml">
					<ui:define name="label">Restrições iniciais</ui:define>
					<h:inputTextarea id="restricoes" cols="80" rows="3"
						value="#{projetoHome.instance.restricoes}" />
				</s:decorate>

				<s:decorate id="produtoField" template="layout/edit.xhtml">
					<ui:define name="label">Descrição do produto</ui:define>
					<h:inputTextarea id="produto" cols="80" rows="3"
						value="#{projetoHome.instance.produto}" />
				</s:decorate>

				<s:decorate id="responsabilidadesgpField"
					template="layout/edit.xhtml">
					<ui:define name="label">Responsabilidades do gerente de projetos</ui:define>
					<h:inputTextarea id="responsabilidadesgp" cols="80" rows="3"
						value="#{projetoHome.instance.responsabilidadesgp}" />
				</s:decorate>

				<div style="clear: both">
					<span class="required">*</span> required fields
				</div>

			</rich:panel>

			<div class="actionButtons">

				<h:commandButton id="save" value="Salvar"
					action="#{projetoHome.persist}" disabled="#{!projetoHome.wired}"
					rendered="#{!projetoHome.managed}" />

				<s:button id="cancelAdd" value="Cancelar" propagation="end"
					view="/#{empty projetoFrom ? 'ProjetoList' : projetoFrom}.xhtml"
					rendered="#{!projetoHome.managed}" />

			</div>
		</h:form>

		<rich:tabPanel switchType="ajax">

			<rich:tab label="Statusprojeto *" labelClass="required">
				<div class="association" id="statusprojetoParent">

					<h:outputText
						value="There is no statusprojeto associated with this projeto."
						rendered="#{projetoHome.instance.statusprojeto == null}" />

					<rich:dataTable var="_statusprojeto"
						value="#{projetoHome.instance.statusprojeto}"
						rendered="#{projetoHome.instance.statusprojeto != null}"
						rowClasses="rvgRowOne,rvgRowTwo" id="statusprojetoTable">
						<h:column>
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_statusprojeto.id}" />
						</h:column>
						<h:column>
							<f:facet name="header">Nome</f:facet>
							<h:outputText value="#{_statusprojeto.nome}" />
						</h:column>
					</rich:dataTable>

					<div class="actionButtons">
						<s:button
							id="#{projetoHome.instance.statusprojeto != null ? 'changeParent' : 'selectParent1'}"
							value="#{projetoHome.instance.statusprojeto != null ? 'Change' : 'Select'} statusprojeto"
							view="/StatusprojetoList.xhtml">
							<f:param name="from" value="ProjetoEdit" />
						</s:button>
					</div>

				</div>
			</rich:tab>

			<rich:tab label="Usuario *" labelClass="required">
				<div class="association" id="usuarioParent">

					<h:outputText
						value="There is no usuario associated with this projeto."
						rendered="#{projetoHome.instance.usuario == null}" />

					<rich:dataTable var="_usuario"
						value="#{projetoHome.instance.usuario}"
						rendered="#{projetoHome.instance.usuario != null}"
						rowClasses="rvgRowOne,rvgRowTwo" id="usuarioTable">
						<h:column>
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_usuario.id}" />
						</h:column>
						<h:column>
							<f:facet name="header">Ddd</f:facet>
							<h:outputText value="#{_usuario.ddd}" />
						</h:column>
						<h:column>
							<f:facet name="header">Email</f:facet>
							<h:outputText value="#{_usuario.email}" />
						</h:column>
						<h:column>
							<f:facet name="header">Endereco</f:facet>
							<h:outputText value="#{_usuario.endereco}" />
						</h:column>
						<h:column>
							<f:facet name="header">Gp</f:facet>
							<h:outputText value="#{_usuario.gp}" />
						</h:column>
						<h:column>
							<f:facet name="header">Login</f:facet>
							<h:outputText value="#{_usuario.login}" />
						</h:column>
						<h:column>
							<f:facet name="header">Nome</f:facet>
							<h:outputText value="#{_usuario.nome}" />
						</h:column>
						<h:column>
							<f:facet name="header">Senha</f:facet>
							<h:outputText value="#{_usuario.senha}" />
						</h:column>
						<h:column>
							<f:facet name="header">Telefone</f:facet>
							<h:outputText value="#{_usuario.telefone}" />
						</h:column>
					</rich:dataTable>

					<div class="actionButtons">
						<s:button
							id="#{projetoHome.instance.usuario != null ? 'changeParent' : 'selectParent2'}"
							value="#{projetoHome.instance.usuario != null ? 'Change' : 'Select'} usuario"
							view="/UsuarioList.xhtml">
							<f:param name="from" value="ProjetoEdit" />
						</s:button>
					</div>

				</div>
			</rich:tab>

			<rich:tab label="Stakeholders">
				<h:form styleClass="association" id="stakeholdersChildren">

					<h:outputText
						value="There are no stakeholders associated with this projeto."
						rendered="#{empty projetoHome.stakeholders}" />

					<rich:dataTable value="#{projetoHome.stakeholders}"
						var="_stakeholder"
						rendered="#{not empty projetoHome.stakeholders}"
						rowClasses="rvgRowOne,rvgRowTwo" id="stakeholdersTable">
						<rich:column sortBy="#{_stakeholder.id}">
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_stakeholder.id}" />
						</rich:column>
						<rich:column sortBy="#{_stakeholder.ccb}">
							<f:facet name="header">Ccb</f:facet>
							<h:outputText value="#{_stakeholder.ccb}" />
						</rich:column>
						<rich:column sortBy="#{_stakeholder.papel}">
							<f:facet name="header">Papel</f:facet>
							<h:outputText value="#{_stakeholder.papel}" />
						</rich:column>
					</rich:dataTable>

				</h:form>

				<f:subview rendered="#{projetoHome.managed}" id="stakeholders">
					<div class="actionButtons">
						<s:button id="addstakeholder" value="Add stakeholder"
							view="/StakeholderEdit.xhtml" propagation="none">
							<f:param name="projetoId" value="#{projetoHome.instance.id}" />
							<f:param name="stakeholderFrom" value="Projeto" />
						</s:button>
					</div>
				</f:subview>
			</rich:tab>

			<rich:tab label="Solicitacaomudancas">
				<h:form styleClass="association" id="solicitacaomudancasChildren">

					<h:outputText
						value="There are no solicitacaomudancas associated with this projeto."
						rendered="#{empty projetoHome.solicitacaomudancas}" />

					<rich:dataTable value="#{projetoHome.solicitacaomudancas}"
						var="_solicitacaomudanca"
						rendered="#{not empty projetoHome.solicitacaomudancas}"
						rowClasses="rvgRowOne,rvgRowTwo" id="solicitacaomudancasTable">
						<rich:column sortBy="#{_solicitacaomudanca.id}">
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_solicitacaomudanca.id}" />
						</rich:column>
						<rich:column sortBy="#{_solicitacaomudanca.dataabertura}">
							<f:facet name="header">Dataabertura</f:facet>
							<h:outputText value="#{_solicitacaomudanca.dataabertura}">
								<s:convertDateTime type="both" dateStyle="short" />
							</h:outputText>
						</rich:column>
						<rich:column sortBy="#{_solicitacaomudanca.datafechamento}">
							<f:facet name="header">Datafechamento</f:facet>
							<h:outputText value="#{_solicitacaomudanca.datafechamento}">
								<s:convertDateTime type="both" dateStyle="short" />
							</h:outputText>
						</rich:column>
						<rich:column sortBy="#{_solicitacaomudanca.descricao}">
							<f:facet name="header">Descricao</f:facet>
							<h:outputText value="#{_solicitacaomudanca.descricao}" />
						</rich:column>
						<rich:column sortBy="#{_solicitacaomudanca.justificativa}">
							<f:facet name="header">Justificativa</f:facet>
							<h:outputText value="#{_solicitacaomudanca.justificativa}" />
						</rich:column>
						<rich:column sortBy="#{_solicitacaomudanca.titulo}">
							<f:facet name="header">Titulo</f:facet>
							<h:outputText value="#{_solicitacaomudanca.titulo}" />
						</rich:column>
					</rich:dataTable>

				</h:form>

				<f:subview rendered="#{projetoHome.managed}"
					id="solicitacaomudancas">
					<div class="actionButtons">
						<s:button id="addsolicitacaomudanca"
							value="Add solicitacaomudanca"
							view="/SolicitacaomudancaEdit.xhtml" propagation="none">
							<f:param name="projetoId" value="#{projetoHome.instance.id}" />
							<f:param name="solicitacaomudancaFrom" value="Projeto" />
						</s:button>
					</div>
				</f:subview>
			</rich:tab>

			<rich:tab label="Tarefas">
				<h:form styleClass="association" id="tarefasChildren">

					<h:outputText
						value="There are no tarefas associated with this projeto."
						rendered="#{empty projetoHome.tarefas}" />

					<rich:dataTable value="#{projetoHome.tarefas}" var="_tarefa"
						rendered="#{not empty projetoHome.tarefas}"
						rowClasses="rvgRowOne,rvgRowTwo" id="tarefasTable">
						<rich:column sortBy="#{_tarefa.id}">
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_tarefa.id}" />
						</rich:column>
						<rich:column sortBy="#{_tarefa.fim}">
							<f:facet name="header">Fim</f:facet>
							<h:outputText value="#{_tarefa.fim}">
								<s:convertDateTime type="both" dateStyle="short" />
							</h:outputText>
						</rich:column>
						<rich:column sortBy="#{_tarefa.inicio}">
							<f:facet name="header">Inicio</f:facet>
							<h:outputText value="#{_tarefa.inicio}">
								<s:convertDateTime type="both" dateStyle="short" />
							</h:outputText>
						</rich:column>
						<rich:column sortBy="#{_tarefa.milestone}">
							<f:facet name="header">Milestone</f:facet>
							<h:outputText value="#{_tarefa.milestone}" />
						</rich:column>
						<rich:column sortBy="#{_tarefa.nome}">
							<f:facet name="header">Nome</f:facet>
							<h:outputText value="#{_tarefa.nome}" />
						</rich:column>
						<rich:column sortBy="#{_tarefa.porcentcomp}">
							<f:facet name="header">Porcentcomp</f:facet>
							<h:outputText value="#{_tarefa.porcentcomp}" />
						</rich:column>
					</rich:dataTable>

				</h:form>

				<f:subview rendered="#{projetoHome.managed}" id="tarefas">
					<div class="actionButtons">
						<s:button id="addtarefa" value="Add tarefa"
							view="/TarefaEdit.xhtml" propagation="none">
							<f:param name="projetoId" value="#{projetoHome.instance.id}" />
							<f:param name="tarefaFrom" value="Projeto" />
						</s:button>
					</div>
				</f:subview>
			</rich:tab>

			<rich:tab label="Licoeses">
				<h:form styleClass="association" id="licoesesChildren">

					<h:outputText
						value="There are no licoeses associated with this projeto."
						rendered="#{empty projetoHome.licoeses}" />

					<rich:dataTable value="#{projetoHome.licoeses}" var="_licoes"
						rendered="#{not empty projetoHome.licoeses}"
						rowClasses="rvgRowOne,rvgRowTwo" id="licoesesTable">
						<rich:column sortBy="#{_licoes.id}">
							<f:facet name="header">Id</f:facet>
							<h:outputText value="#{_licoes.id}" />
						</rich:column>
						<rich:column sortBy="#{_licoes.descricao}">
							<f:facet name="header">Descricao</f:facet>
							<h:outputText value="#{_licoes.descricao}" />
						</rich:column>
						<rich:column sortBy="#{_licoes.titulo}">
							<f:facet name="header">Titulo</f:facet>
							<h:outputText value="#{_licoes.titulo}" />
						</rich:column>
					</rich:dataTable>

				</h:form>

				<f:subview rendered="#{projetoHome.managed}" id="licoeses">
					<div class="actionButtons">
						<s:button id="addlicoes" value="Add licoes"
							view="/LicoesEdit.xhtml" propagation="none">
							<f:param name="projetoId" value="#{projetoHome.instance.id}" />
							<f:param name="licoesFrom" value="Projeto" />
						</s:button>
					</div>
				</f:subview>
			</rich:tab>
		</rich:tabPanel>
	</ui:define>

</ui:composition>
